dhtmlXCalendarObject.prototype.langData["es"] = {
    dateformat: '%d.%m.%Y',
    monthesFNames: ["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"],
    monthesSNames: ["Ene","Feb","Mar","Abr","May","Jun","Jul","Ago","Sep","Oct","Nov","Dec"],
    daysFNames: ["Domingo","Lunes","Martes","Miercoles","Jueves","Viernes","Sabado"],
    daysSNames: ["Do","Lu","Ma","Mi","Ju","Vi","Sa"],
    weekstart: 1
}
dhtmlx.image_path = mainPath+'dhtmlx/imgs/';
	
var actionBar = null,
    dhxLayout = new dhtmlXLayoutObject("mainView", "2U"),
    mainLayout = dhxLayout.cells('a'),
    rightLayout,
    menuLayout,
    statusLayout,
    links,
    detail,
    mainTab = mainLayout.attachTabbar();

statusLayout = dhxLayout.attachStatusBar();
statusLayout.setText("Usuario: "+'<strong>'+getUser+'</strong>');

mainTab.normalize();
mainTab.enableScroll(false);
mainTab.addTab('tab_1','Principal');
mainTab.enableTabCloseButton(true);
mainTab.setContent('tab_1','logoMain');

dhxLayout.cells("b").showHeader();
dhxLayout.cells("b").setWidth('183');
dhxLayout.cells("b").setText('Enlaces Principales'); 
dhxLayout.cells("b").fixSize(true);

rightLayout = new dhtmlXLayoutObject(dhxLayout.cells("b"), "2E");

links = rightLayout.cells("a");
links.hideHeader();
links.attachObject('cpanel');
links.setHeight('183');
links.fixSize(true,true);

detail = rightLayout.cells("b");
detail.setText("Detalle de los &Iacute;tems");
detail.hideHeader();
detail.attachObject('detailMain');

menuLayout = dhxLayout.attachMenu();
menuLayout.setIconsPath(mainPath+'resources/images/icons/');

var sw = 0,
    d = getAcces.split(',');
menuLayout.loadXML(mainPath+'resources/xml/menu.xml', function(){
    menuLayout.forEachItem(function(itemId){
        sw = 0;
        for(var i in d){			
            if(itemId == d[i] || itemId.split('_')[0] == 'sep'){
                sw = 1;
                break;
            }
        }
        if(sw == 0){
            menuLayout.setItemDisabled(itemId);
        }
    });
    mainTab.setTabActive('tab_1');
    /*
    if(getBandera==0)
        mainTab.setTabActive('tab_1');
    else{
        mensajesClass.widgetMain();
        mainTab.setTabActive('tab_1');
        var formData = {idUser: idUsuario};
        $.ajax({
            type: "POST",
            url: mainPath+"index.php/Mens/Mensajes",
            data: formData,
            success: function(response)
            {
                var resData = response.split(',');
                var mostrar="<table align='center' border='1'>";
                mostrar+="<tr><th>Remitente</th><th>Asunto</th><th>Fecha</th></tr>";
                for(i=0;i<=resData.length-2;i=i+3){
                    mostrar+="<tr><td>"+resData[i]+"</td><td>"+resData[i+1]+"</td><td>"+resData[i+2]+"</td></tr>";
                }
                mostrar+="</table>";
                dhtmlx.confirm({
                    title:"Mensajes Nuevos",
                    text:mostrar,
                    callback: function(status){
                        if(status == true){
                            mainTab.setTabActive('mentab');
                        }
                    }
                });
            }
        });
    }*/
});
function widgetBar(obj,sw){
	var me = this;
	me.actionBar =  obj.attachToolbar();
	me.actionBar.setIconsPath(mainPath+'resources/images/icons32/');
	me.actionBar.setIconSize(32);		
	me.actionBar.loadXML(mainPath+"resources/xml/toolbar.xml", function(){
		switch(sw){
			case 1:
                me.actionBar.hideItem('btn_add');
                me.actionBar.hideItem('btn_asing');
                me.actionBar.hideItem('btn_saveas');
				me.actionBar.hideItem('sep_1');
				me.actionBar.hideItem('btn_print');
			break;
            case 2:
                me.actionBar.hideItem('sep_1');
                me.actionBar.hideItem('btn_print');
            break;
            case 3:
                me.actionBar.hideItem('btn_add');
                me.actionBar.hideItem('btn_saveas');
            break;
            case 4:
                me.actionBar.hideItem('btn_add');
                me.actionBar.hideItem('btn_new');
                me.actionBar.setItemText('btn_saveas', 'Transcribir Boleta');
                me.actionBar.disableItem('btn_saveas');
                me.actionBar.setItemText('btn_edit', 'Editar Boleta');
                actionBar.disableItem('btn_edit');
                me.actionBar.hideItem('sep_1');
                me.actionBar.hideItem('btn_print');
                me.actionBar.hideItem('btn_erase');
            break;
		}
	});
	me.actionBar.setAlign('right');
	aux = me.actionBar;
}
function searchTab(idTab){
    var tab = mainTab.getAllTabs();
    for(var i in tab){
        if(tab[i] == idTab)
            return true;
    }
    return false;
}